//
// Created by Administrator on 2022/1/27.
//

#include "Student.h"
/*
public:
string name;
int id;

private:
string sex;
*/


Stdudent::Stdudent()
{
    // 这是构造函数
    cout << "this is construct func" << endl;
}

// 拷贝构造函数
Stdudent::Stdudent(const Stdudent &s )
{
    name = s.name;
    id = s.id;
    setSex( s.sex );
}

Stdudent::Stdudent(int idx)
{
    // 这是构造函数
    id = idx;
    cout << "this is construct func 3 " << endl;
}
Stdudent::~Stdudent()
{
    // 这是析构函数
    int i;
    for( i=0; i<1; i++ )
        cout<< "this is func 2" << endl;
}



// 行为：显示姓名和学号
void Stdudent::showStudent()
{
    cout << "name: " << name << " id: " << id << endl;
}

void Stdudent::showStudent(int)
{
    cout << "name: " << name << " id: " << id << " sex: " << sex << endl;
}

void Stdudent::setSex( string sex_set )   // 利用函数设置参数sex的值
{
    sex = sex_set;
}
string Stdudent::getSex( void )
{
    return sex;
}